package com.ptswitch.material.pages.material;

import org.apache.tapestry5.EventConstants;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.ptswitch.material.model.base.Upload;
import com.ptswitch.material.pages.base.MaterialBasePage;
import com.ptswitch.material.service.MaterialAttachmentService;

public class DownloadAttachment extends MaterialBasePage {
    @Inject
    private MaterialAttachmentService uploadSer;

    @OnEvent(value = EventConstants.ACTIVATE)
    Object download(String id) {
        Upload upload = uploadSer.findById(id);
        return getWebUtil().download(upload);
    }
}
